//
//  LAGMapView.h
//  LAMapBasicDemo
//
//  Created by 罗亮富 on 2017/4/8.
//  Copyright © 2017年 2Bulu. All rights reserved.
//

#import <MapKit/MapKit.h>
#import "LAGMapProtocol.h"
#import "LAGClusterAnnotation.h"


//地图基础功能
@interface LAGMapView : MKMapView<MKMapViewDelegate>
{
    @private
    __weak id<MKMapViewDelegate> _revisedDelegate;
    
//cluster about instance varaible
    @protected
    CGFloat _clusterRadium;//in pixel point
    MKMapRect _lastRefreshMapRect;//上一次做cluster运算时的map rect
    NSMutableArray<id<MKAnnotation>> *_offMapAnnotations;//未添加在地图上的annotation 全部是alone
    NSMutableArray<NSString *> *_allClusterGroups;//所有group
    
    
//#warning for debug
//    NSMutableArray *_debugOverlays;
}

@property (nonatomic, readonly) float zoomLevel;

@property (nonatomic) BOOL igoreAnnotationViewTouchEvent;//ignore annotation user interaction events, default is NO;

-(float)zoomLevelForMapRect:(MKMapRect)mapRect;

@end

#pragma mark- cluster related
@interface LAGMapView (ClusterMake)

@property (nonatomic) CGFloat annotationClusteringRadium; //in pixel point default is 40

-(void)addAnnotations:(nonnull NSArray <id<MKAnnotation>> *)annotations toClusterGroup:(nullable NSString *)groupIdentifier;
//if there are more than 1 annotations to add at a time, use -addAnnotations:toClusterGroup: is more efficient
-(void)addAnnotation:(nonnull id<MKAnnotation>)annotation toClusterGroup:(nullable NSString *)groupIdentifier;

-(void)removeAnnotationsForClusterGroup:(nullable NSString *)groupIdentifier;

-(nullable NSArray <id<MKAnnotation>> *)annotationsForClusterGroup:(nonnull NSString *)groupIdentifier;

//对annotations重新做clustring运算并刷新
-(void)refreshAnnotationCluster;


@end


